package top.wilbert.collegelink.search.controller;/**
 * @author augus
 * @create 2023-03-20-19:59
 */

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import top.wilbert.collegelink.common.exception.BizCodeEnum;
import top.wilbert.collegelink.common.utils.R;
import top.wilbert.collegelink.search.service.ElasticDeleteService;

import java.io.IOException;

/**
 * @ClassName:ElasticDeleteController
 * @Description:
 * @author Augus
 * @date 2023/3/20 19:59
 * @Version 1.0
 **/
@Slf4j
@RequestMapping(value = "/search/delete")
@RestController
public class ElasticDeleteController {

    @Autowired
    ElasticDeleteService elasticDeleteService;

    @GetMapping("/talk")
    public R talkStatusClose(@RequestParam Long talkId) {
        try {
            elasticDeleteService.talkStatusClose(talkId);
        } catch (IOException e) {
            log.error("ElasticSaveController话题关闭错误：{}", e);
            return R.error(BizCodeEnum.TALK_CLOSE_EXCEPTION.getCode(), BizCodeEnum.TALK_CLOSE_EXCEPTION.getMessage());
        }

        return R.ok();
    }
}
